//7:更改管理员密码那题

package 第二章;

import java.util.*;

public class Guanliyuan {
	String ad;
	double code;

	public void gengxin() {
		System.out.print("修改成功！您的新密码为" + code);
	}

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		Guanliyuan g = new Guanliyuan();
		g.ad = "admin";
		g.code = 123;
		while (true) {
			System.out.print("请输入用户名:");
			String answer = "";
			String ad = input.next();
			System.out.print("请输入旧密码:");
			double code = input.nextDouble();
			if (ad.equals(g.ad) && code == g.code) {
				System.out.print("请输入新密码:");
				g.code = input.nextDouble();
				g.gengxin();
				System.out.print("是否继续尝试(y/n):");
				answer = input.next();
				// break;
			} else {
				System.out.print("输入错误,您没有权限修改密码!");
				System.out.print("是否继续尝试(y/n):");
				answer = input.next();
			}
			if (!answer.equals("y"))
				break;

		}
	}
}
